package com.wf.course.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.utils.page.PageBean;
import com.wf.course.dao.IShoppingCartMapper;
import com.wf.course.model.goods.ShoppingCart;
import com.wf.course.service.IShoppingCartService;

@Service
@Transactional(rollbackFor=Exception.class)
public class IShoppingCartServiceImpl implements IShoppingCartService{
	
	@Autowired
	private IShoppingCartMapper mapper;

	@Override
	public void indexInfo(PageBean<ShoppingCart> pageBean) {
		// TODO Auto-generated method stub
		pageBean.setResults(this.mapper.queryList(pageBean));
		pageBean.setTotalCount(this.mapper.getTotalCount(pageBean).intValue());
	}

	@Override
	public void saveOrUpdateShoppingCart(ShoppingCart shoppingCart) {
		// TODO Auto-generated method stub
		
		if(shoppingCart.getId()==null){
			this.mapper.saveShoppingCart(shoppingCart);
		}else{
			this.mapper.updateShoppingCart(shoppingCart);
		}
	}

	@Override
	public ShoppingCart queryShoppingCartById(Integer id) {
		// TODO Auto-generated method stub
		return this.mapper.queryShoppingCartById(id);
	}

	@Override
	public void deleteById(Integer id) {
		// TODO Auto-generated method stub
		this.mapper.deleteById(id);
	}

 
	
}
